import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "DBshop017_添加属性组"
#1.点击“添加属性组”，编辑属性组名称“好好学习”，属性组排序“1”。
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
#打开三级菜单
DBshopEnterMenu3(firefox,"商品管理","商品属性","属性分组")

firefox.find_element_by_xpath("//a[@class='btn btn-small btn-primary']").click()
firefox.find_element_by_xpath("//input[@id='attribute_group_name']").send_keys("好好学习,天天向上")
firefox.find_element_by_xpath("//input[@id='attribute_group_sort']").clear()
firefox.find_element_by_xpath("//input[@id='attribute_group_sort']").send_keys("1")
time.sleep(4)
firefox.find_element_by_xpath('//button[@type="submit"]').click()
#2.点击“保存属性分组信息”
try:
    firefox.find_element_by_xpath("//td[contains(.,'好好学习,天天向上')]")
    writeLog("%s测试通过"%testCase)
except:
    writeLog("%s测试失败"%testCase)
    getPhoto(firefox)
firefox.quit()